package com.example.cloud.model.finance;

import com.example.cloud.model.common.CommonModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import java.math.BigDecimal;

/**
 * Created by wangtao on 2018/7/30.
 * 待付款
 */
@Entity(name = "finance_charge_details")
@Data
@EqualsAndHashCode(callSuper = false)
public class ChargeDetails extends CommonModel {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    // 购买患者
    @Column(name = "patient_id")
    private Long patientId;
    // 会员主键
    @Column(name = "member_id")
    private Long memberId;
    // 业务主键
    @Column(name = "business_id")
    private Long businessId;
    // 业务类型{1: 单次治疗收费 2：长期治疗收费 3：病房收费 4：外科}
    @Column(name = "business_type")
    private int businessType;
    // 收费类型{1: 项目类 2：产品类}
    @Column(name = "charge_type")
    private int chargeType;
    // 商品主键
    @Column(name = "item_id")
    private Long itemId;
    // 业务名称
    @Column(name = "item_name")
    private String itemName;
    // 购买数量
    @Column(name = "quantity")
    private int quantity;
    // 价格
    @Column(name = "price", precision = 12, scale = 2)
    private BigDecimal price;
    // 应付金额
    @Column(name = "total_price", precision = 12, scale = 2)
    private BigDecimal totalPrice;
    // 是否续费{0: 否 1：是}
    @Column(name = "is_renew",columnDefinition = "INT DEFAULT 0")
    private int isRenew;
    // 使用折扣
    @Transient
    private Double discount = 0d;
    // 优惠金额
    @Transient
    private BigDecimal discountAmount = BigDecimal.ZERO;
    // 实付金额
    @Transient
    private BigDecimal actualAmount = BigDecimal.ZERO;
    // 收费状态{0：未收费 1：已收费}
    @Column(name = "charge_status", columnDefinition = "INT DEFAULT 0")
    private int chargeStatus;
    // 治疗卡号
    @Column(name = "card_number")
    private String cardNumber;
}
